"""
   -*- coding: utf-8 -*-
   @Time    : 2021/4/9 18:57
   @Author  : 狠欢
   @File    : 作业--实现tree功能.py
   @Software: PyCharm
"""
import os

# 获取当前路径
get_position = os.getcwd()
# print(get_position)
# print(os.path.join(get_position,))
# 递归输出目录或文件
# print(os.listdir(get_position))
# 判断文件是否为目录如果是目录就列出其文件


def put_tree(get_position,n):
    for file_name in os.listdir(get_position):
        print("|___"*n, file_name)

        if os.path.isfile(file_name):
            continue

        if os.path.isdir(os.path.join(get_position, file_name)):
            put_tree(os.path.join(get_position, file_name),n+1)

put_tree(get_position,0)










